<?php
/**
 * Created by PhpStorm.
 * User: 于婧雯
 * Date: 2019/2/18
 * Time: 10:02
 */
namespace App\Http\Controllers\NewAdmin;

use App\Http\Controllers\AdapterWebController;
use Illuminate\Http\Request;
use App\Modules\UCenter\Message as ApiMessage;

//后台站内信管理
class Message extends AdapterWebController
{
    // 站内信列表
    public function adminMessageList(Request $request)
    {
        if (empty($request['keywords'])) {
            $postData['keywords'] = '';
        } else {
            $postData['keywords'] = $request['keywords'];
        }
        $list = $this->appLayerExec(ApiMessage::class, 'adminMessageList', $postData);
        return view('newAdmin.message.message_list', ['list' => $list['res']]);
    }

    // 删除站内信
    public function adminDelOneMessage($id)
    {
        $postData['id'] = (int)$id;
        $res = $this->appLayerExec(ApiMessage::class, 'adminDelOneMessage', $postData);
        if ($res['code'] == 200) {
            return ['status' => 0, 'msg' => '站内信已删除!'];
        }
        return ['status' => -1, 'msg' => '站内信删除异常，请重试!'];
    }

}
